x86/VPMU: manage VPMU_CONTEXT_SAVE flag in vpmu_save_force()
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>
Fri, 23 Jan 2015 16:50:53 +0000 (17:50 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 23 Jan 2015 16:50:53 +0000 (17:50 +0100)
commit028afee0e10af22219efd601ea4016c77324af55
treea2ba5569ccfc63011132bc9ea2cec697b0ee6034
parentd0f60c178b6e35303d53ffe99e174d0b9f806352
x86/VPMU: manage VPMU_CONTEXT_SAVE flag in vpmu_save_force()

There is a possibility that we set VPMU_CONTEXT_SAVE on VPMU context in
vpmu_load() and never clear it (because vpmu_save_force() will see
VPMU_CONTEXT_LOADED bit clear, which is possible on AMD processors)

The problem is that amd_vpmu_save() assumes that if VPMU_CONTEXT_SAVE is set
then (1) we need to save counters and (2) we don't need to "stop" control
registers since they must have been stopped earlier. The latter may cause all
sorts of problem (like counters still running in a wrong guest and hypervisor
sending to that guest unexpected PMU interrupts).

Since setting this flag is currently always done prior to calling
vpmu_save_force() let's both set and clear it there.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Tested-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
xen/arch/x86/hvm/vpmu.c